@extends('layouts.admin')

@section('content')
<section id="main-content">
  <section class="wrapper">
      <!-- page start-->
      <div class="row">
          <div class="col-lg-12">
              <section class="panel">


                <div class="panel panel-default">
                    <div class="panel-heading">
                        <div class="panel-btns pull-right">
                            <a href="" class="panel-close">×</a>
                            <a href="" class="minimize">−</a>
                        </div>
                        <h4 class="panel-title">编辑菜单[{{ $menu->name }}]</h4>
                    </div>

                    <form class="form-horizontal form-bordered" action="{{ route('admin.wechat.menu.update',['id'=>$menu->id]) }}" method="POST">

                    <div class="panel-body panel-body-nopadding">
                        <div class="form-group">
                            <label class="col-sm-3 control-label">所属菜单组</label>

                            <div class="col-sm-6">
                                <select class="form-control input-sm" name="fid">
                                    <option value="0">--顶级权限--</option>
                                    @foreach ($fmenus as $fmenu)
                                        <option value="{{ $fmenu->id }}" {{ $fmenu->id==$menu->fid ? 'selected':'' }}>{{ $fmenu->name }}</option>
                                    @endforeach
                                </select>
                                
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-3 control-label">显示名称</label>

                            <div class="col-sm-6">
                                <input type="text" class="form-control" name="name" value="{{ $menu->name }}">
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-3 control-label">Url</label>

                            <div class="col-sm-6">
                                <input type="text" class="form-control" name="url" value="{{ $menu->url }}">
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-3 control-label">Key</label>

                            <div class="col-sm-6">
                                <input type="text" class="form-control" name="key" value="{{ $menu->key }}">
                            </div>
                        </div>
                        
                        <div class="form-group">
                            <label class="col-sm-3 control-label">MediaId</label>

                            <div class="col-sm-6">
                                <input type="text" class="form-control" name="media_id" value="{{ $menu->media_id }}">
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-3 control-label">类型</label>

                            <div class="col-sm-1">
                                <select class="form-control input-sm" name="type">
                                    <option value="view" {{ $menu->type=='view' ? 'selected':'' }} >跳转URL</option>
                                    <option value="click" {{ $menu->type=='click' ? 'selected':'' }} >点击推事件</option>
                                </select>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-3 control-label">排序</label>

                            <div class="col-sm-1">
                                <input type="text" class="form-control" name="sort"
                                       value="{{ $menu->sort }}">
                            </div>
                        </div>

                        {{ csrf_field() }}
                    </div><!-- panel-body -->

                    <div class="panel-footer">
                        <div class="row">
                            <div class="col-sm-6 col-sm-offset-3">
                                <button class="btn btn-primary">保存</button>
                            </div>
                        </div>
                    </div><!-- panel-footer -->

                    </form>
                </div>

              </section>
          </div>
      </div>
      <!-- page end-->
  </section>
</section>           
@endsection
